<script src="<?php echo APP_TEMPLATES_URL;?>/js/common.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="<?php echo APP_TEMPLATES_URL;?>/css/public.css" />
<link rel="stylesheet" href="<?php echo APP_TEMPLATES_URL;?>/css/mui.min.css">
<script src="<?php echo APP_TEMPLATES_URL;?>/js/mui.min.js"></script>
<script type="text/javascript" src="<?php echo APP_SITE_URL;?>/js/zepto.min.js"></script>
<script type="text/javascript" src="<?php echo APP_SITE_URL;?>/js/template.js"></script>
<style>
	.logrecharge td {
		vertical-align: middle;
		height: 75px;
		border-bottom: 1px solid #f4f4f4;
		font-size: 14px;
	}
	
	.logrecharge1 td {
		vertical-align: middle;
		height: 50px;
		text-align: center;
		font-size: 16px;
	}
	
	.indexm {
		display: none;
	}
	
	tr:active {
		background: #F5F5F5;
	}
	
	a:active {
		color: #f2b743;
	}
	
	a:hover {
		color: #f2b743;
	}
	
	.jiao li {
		float: left;
		width: 25%;
		height: 48px;
		line-height: 48px;
		text-align: center;
		font-size: 16px;
	}
	
	.jiao li.onindex {
		border-bottom: 3px solid #f2b743;
	}
</style>
<script>
function go_back(){
	window.location.href = 'index.php?act=predeposit&op=moneybag';
}
</script>
<!-- 导航 -->
<div class="mui-bar mui-bar-nav bj">
	<button class="mui-btn mui-btn-link mui-btn-nav mui-pull-left zys">
				<img style=" max-width: 50%; vertical-align: middle;" src="<?php echo APP_TEMPLATES_URL;?>/images/back.png"  onclick="go_back()" />
			</button>
	<h1 class="mui-title"><label style="font-size: 22px;vertical-align: middle;">交易记录</label></h1>
</div>

<!--<div style="padding: 0 10px; border-bottom: 1px solid #DDDDDD;">
	<ul class="jiao">
		<li class="onindex">
			<a href="#">全部</a>
		</li>
		<li>
			<a href="#">收入</a>
		</li>
		<li>
			<a href="#">支出</a>
		</li>
		<li>
			<a href="#">消费</a>
		</li>
	</ul>
</div>-->

<table class="logrecharge1" width="100%">
	<tr>
		<td style="background: #f5f5f5;color: #999;">变更说明</td>
		<td style="background: #f5f5f5;color: #999;width: 128px;"></td>
		<td style="background: #f5f5f5;color: #999; text-align: center;">余额</td>
	</tr>
</table>

<div class="mui-content">
	<div id="pullrefresh" class="mui-content mui-scroll-wrapper" style="top: 52px;background-color: #FFFFFF;">
		<div class="mui-scroll">
			<table class="logrecharge" style="width: 100%;" id="trade_content">
			<?php  if (count($output['list'])>0) { ?>
				<?php foreach($output['list'] as $val) { ?>
				<tr>
					<td>
						<p style="padding-left:20px; color: #000;font-size: 14px;"><?php echo substr($val['lg_desc'],0,strrpos($val['lg_desc'],'，'));?></p>
						<p style="padding-left:20px; color: #999;font-size: 14px;"><?php echo date('Y-m-d', $val['lg_add_time']);?></p>
					</td>
					<td>
						<p style="padding-right:10px ; text-align: right; color: #000;"><?php echo floatval($val['lg_av_amount']) ? (floatval($val['lg_av_amount']) > 0 ? '收入' : '支出' ) : null;?></p>
						<p style="padding-right:10px ; text-align: right; color: #333;"><?php echo floatval($val['lg_av_amount']) ? (floatval($val['lg_av_amount']) > 0 ? '+' : null ).$val['lg_av_amount'] : null;?></p>
					</td>
					<td width="20">
						<!--<img style=" vertical-align: middle;" src="<?php /*echo APP_TEMPLATES_URL;*/?>/images/goto.png" />-->
					</td>
				</tr>
				<?php } } ?>
			</table>
		</div>
	</div>
</div>

<script type="text/html" id="record-list">
	<%
	if(list_log.length >0){
	for (var i = 0;i<list_log.length;i++){
	%>
	<tr>
		<td>
			<p style="padding-left:20px; color: #000;font-size: 14px;"><%=list_log[i].lg_desc%></p>
			<p style="padding-left:20px; color: #999;font-size: 14px;"><%=list_log[i].lg_add_time%></p>
		</td>
		<td>
			<p style="padding-right:10px ; text-align: right; color: #000;"><%=list_log[i].lg_av_amount_desc%> </p>
			<p style="padding-right:10px ; text-align: right; color: #333;"><%=list_log[i].lg_av_amount_show%></p>
		</td>
		<td width="20">
			<!--<img style=" vertical-align: middle;" src="<?php /*echo APP_TEMPLATES_URL;*/?>/images/goto.png" />-->
		</td>
	</tr>
	<% }
	}%>
</script>

<script type="application/javascript">
	var curpage = 1;
	var totalPage = <?php echo $output['totalPage']; ?>;
	mui.init({
		pullRefresh: {
			container: '#pullrefresh',
			up: {
				contentrefresh: '正在加载...',
				callback: pullupRefresh
			}
		}
	});
	var count = 0;
	/**
	 * 上拉加载具体业务实现
	 */
	function pullupRefresh() {
		setTimeout(function() {
			mui('#pullrefresh').pullRefresh().endPullupToRefresh((totalPage<=curpage)); //参数为true代表没有更多数据了。
			if(totalPage>curpage){
				$.getJSON("index.php?act=predeposit&op=trade_logListPage&curpage="+curpage, function(e) {
					curpage = e.datas.curpage;
					$("#trade_content").append(template.render("record-list", e.datas));
				});
			}
		}, 1500);
	}
</script>